#pragma once
#include <iostream>
using namespace std;

class Remote;

class Tv
{
public:
	friend class Remote;
	enum{Off,On};
	enum{MinVal,MaxVal=20};
	enum{Antrnna,Cable};
	enum{TV,DVD};

	Tv(int s=Off,int mc=125):state(s),volume(5),maxchannel(mc),channel(2),mode(Cable),input(TV){}
	void onoff() { state = (state == On) ? Off : On; }
	bool ison()const { return state == On; }
	bool volup();
	bool voldown();
	void chanup();
	void chandown();
	void set_mode() { mode = (mode == Antrnna) ? Cable : Antrnna; }
	void set_input() { input = (input == TV) ? DVD : TV; }
	void settings()const;

	void set_Rmode(Remote& r);

private:
	int state;
	int volume;
	int maxchannel;
	int channel;
	int mode;
	int input;
};

class Remote
{
private:
	int mode;
	int work_mode;

public:
	enum{Normal,InterActive};
	
public:
	friend class Tv;
	Remote(int m=Tv::TV):mode(m){}
	bool volup(Tv& t) { return t.volup(); }
	bool voldown(Tv& t) { return t.voldown(); }
	void onoff(Tv& t) { t.onoff(); }
	void chanup(Tv& t) { t.chanup(); }
	void chandown(Tv& t) { t.chandown(); }
	void set_mode(Tv& t) { t.set_mode(); }
	void et_input(Tv& t) { t.set_input(); }
	void set_chan(Tv& t, int chan) { t.channel = chan; }

	int showMode() const{ return work_mode; }

};

